﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using HotelSoft.HotelManagement_BUS;
using HotelSoft.HotelManagement_DTO;

namespace HotelSoft.HotelManagement_GUI
{
    public partial class frmReport_Phong : Form
    {
        PhongBUS busPhong = new PhongBUS();
        public frmReport_Phong()
        {
            InitializeComponent();
        }

        public void LoadCombobox()
        {
            List<LoaiPhongDTO> dsphong = LoaiphongBUS.LayDSLoaiPhong();
            Cbm_Loaiphong.DataSource = dsphong;
            Cbm_Loaiphong.DisplayMember = "TenLP";
            Cbm_Loaiphong.ValueMember = "TenLP";

        }
        private void buttonX1_Click(object sender, EventArgs e)
        {
            if (Cbm_Loaiphong.SelectedIndex >= 0)
            {
                LoaiPhongDTO phong = (LoaiPhongDTO)Cbm_Loaiphong.Items[Cbm_Loaiphong.SelectedIndex];
                DataTable dt = new DataTable();
                Docphong = new rptReport_Phong();
                string s = Application.StartupPath + "\\rptReport_Phong.rpt";
                Docphong.Load(s);

                dt = busPhong.dataTablegetListPhong1(phong.TENLP);
                Docphong.Database.Tables["command"].SetDataSource(dt);
                Viewphong.ReportSource = Docphong;
            }
        }

        private void Viewphong_Load(object sender, EventArgs e)
        {
            LoadCombobox();
        }

        private void btnClose_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void panel2_Paint(object sender, PaintEventArgs e)
        {

        }

       
    }
}
